import React from "react";
// import { PullToRefresh } from "antd-mobile";
import Banner from "@/views/viewCommon/Banner";
import LoanItem from "../loanOrPayItem/loan";

const Loan = props => {
	const { data = [], banner, children } = props;
	// const onRefresh = () => {};
	//去详情
	const checkDetail = item => {
		const { cino } = item;
		props.history.replace(`/xhdRecordDetail/${cino}`);
	};

	return (
		<>
			{!!banner.length && (
				<Banner bannerList={banner} history={props.history} />
			)}
			{data.map((item, index) => (
				<LoanItem
					onClick={() => {
						checkDetail(item);
					}}
					loanData={item}
					key={index}
					checkDetail={checkDetail}
				/>
			))}
			{!data.length && children}
		</>
	);
};
export default Loan;
